package com.taotao.conf.intercepter;

import com.taotao.common.auth.AuthHandlerInterceptor;
import com.taotao.common.auth.AuthRequired;
import com.taotao.common.auth.satoken.SatokenUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 * 仅校验是否登录
 * </p>
 *
 * @author fanbeibei
 * @version 1.0.0
 * @date 2023/6/26 16:46
 */
public class LoginRequiredInterceptor extends AuthHandlerInterceptor {
    @Override
    protected boolean validFuncAccess(String funcCode, Long userId) {
        return true;
    }

    @Override
    protected Long getUserId(HttpServletRequest request) {
        return null;
    }

    @Override
    protected boolean validLoginRequired(HttpServletRequest request, HttpServletResponse response, AuthRequired authRequired) {

        return null != SatokenUtils.getUserId();
    }
}
